/*! \file MemoryBuffer.cpp
 *	\brief 
 *
 *	created:	2010/08/10
 *	created:	10:8:2010   12:57
 *	filename: 	C:\Users\venn\Documents\projects\tactics-engine\libs\utils\MemoryBuffer.cpp
 *	file path:	C:\Users\venn\Documents\projects\tactics-engine\libs\utils
 *	file base:	MemoryBuffer
 *	file ext:	cpp
 *	author:		Vitalii Trubchaninov
 *				venngraydog@gmail.com
 */
#include "utils/stdafx.h"
#include "utils/MemoryBuffer.h"

#include <io/StreamUtils.h>

namespace tt{
namespace utils{

MemoryBuffer::MemoryBuffer()
{

}

MemoryBuffer::~MemoryBuffer()
{

}

void MemoryBuffer::create( io::BaseIStream& is )
{
	Size isSize = io::streamSize(is);
	m_buffer.resize(isSize);
	is.read((char*)&m_buffer.front(), isSize);
}

Size MemoryBuffer::size() const
{
	return m_buffer.size();
}

const void* MemoryBuffer::data() const
{
	return reinterpret_cast<const void*>(&m_buffer.front());
}

} //namespace utils
} //namespace tt